package zhongbo.java.air.ingestion.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import zhongbo.java.air.ingestion.config.RedisListenerConfig;

@Component
@Slf4j
public class RedisPublisher {

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    /**
     * 广播消息到 injest_flight_path_chen_xiao_qi 频道
     *
     * @param message 消息文本
     */
    public void sendMessage(String message) {
        log.info("发送消息到 injest_flight_path_chen_xiao_qi: {}", message);
//        redisTemplate.convertAndSend(RedisListenerConfig.LOG_CHANEL, message);
        redisTemplate.convertAndSend(RedisListenerConfig.CHANEL, message);
    }
}